#include<iostream>
#include<math.h>
#include<algorithm>
using namespace std;
typedef long long ll;
const int N = 2e5 + 10;
int a[N];
int n, l, r;
ll ans = 0;
int main() {
    cin >> n >> l >> r;
    for (int i = 1; i <= n; i++) cin >> a[i];
    sort(a + 1, a + 1 + n);
    for (int i = 1, j = 1, z = 1; i <= n; i++)
    {
        while (j <= n && abs(a[j] - a[i]) < l)
        {
            ++j;
        }
        while (z <= n && abs(a[z] - a[i]) <= r)
        {
            ++z;
        }
        ans += z - j;
    }
    cout << ans;
    return 0;
}